package com.erp.order.controller;

import com.erp.order.domain.vo.ErpSellerOrderLogVo;
import com.ruoyi.common.core.enums.OrderLogType;
import com.erp.order.service.IErpSellerOrderLogService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.oldController.BaseController;
import com.ruoyi.order.api.domain.ErpSellerOrderLog;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/order/sellerOrderLog")
public class ErpSellerOrderLogController extends BaseController {
    
    private final IErpSellerOrderLogService orderLogService;


    /**
     * 订单日志信息
     */
    @GetMapping("/getOrderLog")
    public List<ErpSellerOrderLogVo> getOrderLog(Long orderId) {
        return orderLogService.selectOrderLogByOrderId(orderId);
    }
    
    @GetMapping("/createOrderLog")
    public R<Object> createOrderLog(@RequestParam("orderId") Long orderId,@RequestParam("childOrderId") String childOrderId,@RequestParam("orderLogType") OrderLogType orderLogType
            ,@RequestParam("remark") String remark,@RequestParam("orderProcessFlagInfo") String orderProcessFlagInfo,@RequestParam("erpStatus") String erpStatus) {
        return orderLogService.createOrderLog(orderId,childOrderId,orderLogType,remark,orderProcessFlagInfo,erpStatus);
    }

    /**
     * 获取到最新的一条日志
     */
    @GetMapping("/getStatusIntro/{orderId}")
    public ErpSellerOrderLog getStatusIntro(@PathVariable("orderId") Long orderId) {
        return orderLogService.getStatusIntro(orderId);
    }

    /**
     * 修改订单日志
     */
    @PutMapping("/order/sellerOrderLog/updateOrderLog")
    R<Void> updateOrderLog(@RequestBody ErpSellerOrderLog log) {
        return null;
    }
    
}
